﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Back/Shared/BackBBSSite.Master"
    Inherits="System.Web.Mvc.ViewPage<Wwtfly.BBS.BackModels.ViewModels.News.NewsShowsViewModel>" %>

<%@ Import Namespace="Wwtfly.Utility" %>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <% using (Html.BeginForm(Html.GetEditActionName(Model.NewsShows.Id), "BackNews"))
       {%>
    <%= Html.ValidationSummary(true) %>
    <%= Html.HiddenFor(mc=>mc.NewsShows.Id) %>
    <fieldset  class="editor-fieldset">
        <legend>编辑</legend>
         <div class="editor-label-field-row">
            <div class="editor-label">
                新闻标题
            </div>
            <div class="editor-field editor-field3">
                <%= Html.TextBoxFor(model => model.NewsShows.NewsTitle)%>&nbsp;<span class="cRed">*</span>
            </div>
        </div>
        <div class="blank_2"></div>
        <div class="editor-label-field-row">
            <div class="editor-label">
                新闻类型
            </div>
            <div class="editor-field">
                <%=Html.DropDownListFor(model => model.NewsShows.TypeId,Model.NewTypesList,"请选择") %>
            </div>
        </div>
        <div class="blank_2">
        </div>
        <div class="editor-label-field-row">
            <div class="editor-label">
                关键词
            </div>
            <div class="editor-field">
                <%= Html.TextBoxFor(model => model.NewsShows.Keyword)%>
            </div>
        </div>
        <div class="blank_2">
        </div>
       
        <div class="editor-label-field-row">
            <div class="editor-label">
                新闻时间
            </div>
            <div class="editor-field">
                <%= Html.TextBox("NewsShows.NewsInTime", 
                Model.NewsShows.NewsInTime.HasValue?
                Model.NewsShows.NewsInTime.DateToString():DateTime.Now.DateToString(),
                          new { @class = "datepicker" })%>
            </div>
        </div>
        <div class="blank_2">
        </div>
        <div class="editor-label-field-row">
            <div class="editor-label">
                点击量
            </div>
            <div class="editor-field">
                <%= Html.TextBox("NewsShows.NewsClick",
                       Model.NewsShows.Id<=0 ?
                       (Model.NewsShows.NewsClick == 0 ? string.Empty : Model.NewsShows.NewsClick.ToString()):
                       Model.NewsShows.NewsClick.ToString()
            )%>
            </div>
        </div>
        <div class="blank_2">
        </div>
        <div class="editor-label-field-row">
            <div class="editor-label">
                新闻标签
            </div>
            <div class="editor-field">
                <%= Html.TextBoxFor(model => model.NewsShows.NewsTag) %>
            </div>
        </div>
        <div class="blank_2">
        </div>
        <div class="editor-label-field-row">
            <div class="editor-label">
                新闻内容
            </div>
            <div class="editor-field">
                <%= Html.TextAreaFor(model => model.NewsShows.NewsContent, new { id = "newsContent" })%>
            </div>
        </div>
        <div class="blank_2">
        </div>
        <div class="editor-label-field-row">
            <div class="editor-label">
                是否展示
            </div>
            <div class="editor-field">
            <%
                //如果是新增,则默认为是
           if (Model.NewsShows.Id <= 0) { Model.NewsShows.NewsState = true; }
                 %>
            <%=Html.DropDownListYesOrNoFor(model => model.NewsShows.NewsState,null,null) %>
            </div>
        </div>
        <div class="blank_2">
        </div>
        <div class="editor-label-field-row">
            <div class="editor-label">
                备注
            </div>
            <div class="editor-field">
                <%= Html.TextAreaFor(model => model.NewsShows.NewsRemark, 4, 30, new {@class="w225" })%>
            </div>
        </div>
        <div class="blank_2">
        </div>
        <p>
            <% string returnUrl = Request.GetRequestReturnUrl("returnUrl", Url.Action("Index")); %>
            <input type="submit" value="保存" id="btn_save" url=" <%=returnUrl %>" />
            &nbsp;
            <%=Html.Button("返回", "btn_return", new { url = returnUrl })%>
        </p>
    </fieldset>
    <% } %>
    <div>
    </div>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HeadContent" runat="server">
    <script src="<%=Url.Content("~/Content/ckeditor/ckeditor.js") %>" type="text/javascript"></script>
    <script type="text/javascript">

        $(document).ready(function () {
            window.validateForm = function () { return true; };
            window.ajaxForm();
            window.unloadForm();
            CKEDITOR.replace('newsContent');

            //在jquery 序列化 数据之前,事件
            $("form").bind('form-pre-serialize', function (event, form, options, veto) {
                //从编辑器拿值
                var objcet = eval("(CKEDITOR.instances.newsContent)");
                if (objcet != null) {
                    $("#newsContent").val(objcet.getData());
                }
            });
        });
    
    </script>
</asp:Content>
